package com.example.boot.utils

import org.springframework.stereotype.Component

@Component
class CurrentFacade {

    fun setVal(name: String) {
        Context.setVar(name)
    }

    fun getVal(): String {
        return Context.getVar()
    }

    private class Context {

        companion object {
            private val current = InheritableThreadLocal<String>()

            fun setVar(name: String) {
                current.set(name)
            }

            fun getVar(): String {
                return current.get()
            }
        }
    }
}